using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_DanhMucUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        try
        {
            int iD = int.Parse(Request.QueryString["iD"].ToString());
            txt_madanhmuc.Text = iD.ToString();
            tbDanhMuc danhmuc = tbDanhMucBUS.GetByID(iD);
            txt_tendanhmuc.Text=danhmuc .TenDanhMuc ;
        }
        catch
        {
            Response.Redirect("~/Admin/DanhMucDanhSach.aspx");
        }
    }

    protected void btn_sua_Click(object sender, EventArgs e)
    {
        try
        {
            int iD=int.Parse (Request .QueryString ["iD"].ToString ());
            tbDanhMuc danhmuc=tbDanhMucBUS .GetByID (iD);
            danhmuc .TenDanhMuc =txt_tendanhmuc .Text ;
            tbDanhMucBUS .Update (danhmuc );
        }
        catch
        {
        }
        Response.Redirect("~/Admin/DanhMucDanhSach.aspx");
        Response.Redirect(Request.RawUrl);
    }
}

